package com.lzq.Injector;

import com.baomidou.mybatisplus.core.injector.AbstractMethod;
import com.baomidou.mybatisplus.core.injector.AbstractSqlInjector;
import com.baomidou.mybatisplus.core.injector.methods.*;
import com.lzq.Injector.methods.InsertBatch;
import com.lzq.Injector.methods.InsertOrUpdateById;
import com.lzq.Injector.methods.InsertOrUpdateByIdBatch;
import com.lzq.Injector.methods.old.QueryById;


import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * 自定义 SQL 注入 Mapper
 *
 * @author pengrx
 */
public class CacSqlInjector extends AbstractSqlInjector {

    @Override
    public List<AbstractMethod> getMethodList() {
        return Stream.of(
                // 注入默认方法
                new Insert(),
                new Delete(),
                new DeleteByMap(),
                new DeleteById(),
                new DeleteBatchByIds(),
                new Update(),
                new UpdateById(),
                new SelectById(),
                new SelectBatchByIds(),
                new SelectByMap(),
                new SelectOne(),
                new SelectCount(),
                new SelectMaps(),
                new SelectMapsPage(),
                new SelectObjs(),
                new SelectList(),
                new SelectPage(),

                // 注入自定义方法
                new InsertBatch(),
                new InsertOrUpdateById(),
                new InsertOrUpdateByIdBatch(),

                // 兼容旧框架
                new QueryById()
        ).collect(Collectors.toList());
    }
}
